/* 用户注册 */
const router = require("koa-router")();
import { ReadFile, WriteFile } from "../utils/ReadWriteFile";
import { createId } from "../utils/createId";
/* 查询所有的普通用户*/
router.post("/api/removeAnnouncement", async (ctx) => {
  const { id } = ctx.request.body;
  let type = "Announcement"
  let result = await ReadFile(type);
  let res = result.find((item) => item.id == id);
  let res1 = result.filter((item) => item.id != id);
  WriteFile({
    type,
    result:res1,
  });
  ctx.body = {
    code: 200,
    msg: "删除成功",
    id,
    res1,
    res
  };
});
module.exports = router;
